var openId ,nikeName
// 获取cookie
function getCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}

var fansHeadImg = getCookie("img")
openId = getCookie("openId")
nikeName = getCookie("nikeName")
console.log(nikeName)
console.log(openId)
// 绑定cookie里面的粉丝头像
$(".left_chat .fans_headimg").attr("src" , fansHeadImg)


// 获取聊天记录
function fansChat(callback){
    $.ajax({
        dataType: 'JSON',
        type: 'post',
        url: '/admin/custm_svc/getCusmChatReord',
        data: '',
        success: function(res){
            console.log(res)
            var aaa = []
            for(var i in res[openId]){
                console.log(res[openId][i])
                aaa.push(res[openId][i])
            }
            callback(aaa)
        }
    })
}


// 时间戳转换为日期格式
function changeTime(time){
    var date = new Date(time*1000);
    Y = date.getFullYear() + '-';
    M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    D = date.getDate() + ' ';
    h = date.getHours() + ':';
    m = date.getMinutes() + ':';
    s = date.getSeconds(); 
    return M+D+h+m+s
}






